package com.yyp.car.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yyp.car.Iservice.IGroundService;
import com.yyp.car.model.Ground;

@Controller
@RequestMapping("/ground")
public class GroundController {
	@Resource(name="groundService")
	private IGroundService groundService;
	
	@RequestMapping("/addGround")
	public String addGround(Ground ground){
		groundService.addGround(ground);
		return "redirect:/back/groundManager";
	}
	
	@RequestMapping("/updateGround")
	public String updateGround(Ground ground){
		groundService.updateGround(ground); 
		return "redirect:/back/groundManager";
	}
	
	@RequestMapping("/deleteGround/{id}")
	public String deleteGround(@PathVariable int id){
		groundService.delete(id);
		return "redirect:/back/groundManager";
	}

}
